local sk_le__lingxin = fk.CreateSkill {

  name = "sk_le__lingxin",

  tags = {},

}

Fk:loadTranslationTable {
  ["sk_le__lingxin"] = "灵心",
  [":sk_le__lingxin"] = "当你使用锦囊牌时，你可以摸一张牌并从牌堆获得一张基本牌，你以此法获得的基本牌不计入手牌上限，且无使用次数限制。",
  ["@@sk_le__lingxin-inhand"] = "灵心",
  ["$sk_le__lingxin1"] = "慧思万千，集智大成。",
  ["$sk_le__lingxin2"] = "才学智趣，蕙质兰心。",
}

sk_le__lingxin:addEffect(fk.CardUsing, {
  name = "sk_le__lingxin",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk_le__lingxin.name) and data.card.type == Card.TypeTrick
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, sk_le__lingxin.name)
    local cid2 = room:getCardsFromPileByRule(".|.|.|.|.|basic", 1, "drawPile")
    if #cid2 == 0 then return end
    room:obtainCard(player, cid2, false, fk.ReasonPrey, player, sk_le__lingxin.name, "@@sk_le__lingxin-inhand")
  end,
})

sk_le__lingxin:addEffect("maxcards", {
  exclude_from = function(self, player, card)
    return card:getMark("@@sk_le__lingxin-inhand") > 0
  end,
})

sk_le__lingxin:addEffect("targetmod", {
  bypass_times = function(self, player, skill, scope, card, to)
    return card:getMark("@@sk_le__lingxin-inhand") > 0
  end
})


return sk_le__lingxin
